import Vue from 'vue'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './styles/element-variables.scss'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log
import request from '@/utils/request'
import * as filters from './filters' // global filters
import VueHighlightJS from 'vue-highlight.js'
import './utils/registerCatchTable'
import formCreate from '@form-create/element-ui'

Vue.use(Element, {
  size: 'small'// set element-ui default size
  // locale: enLang // 如果使用中文，无需设置，请删除
})

Vue.use(VueHighlightJS)
Vue.use(formCreate)
// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

// ****************************************************************************************************
// * iview
// ****************************************************************************************************

// 懒加载
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: require('./assets/icon_images/no.png'),
  loading: require('./assets/icon_images/moren.jpg'),
  attempt: 1,
  listenEvents: ['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove']
})

// iView 和 iView Pro
import ViewUI from 'view-design'
import iViewPro from '@/libs/iview-pro/iview-pro.min.js'

// 使用样式，修改主题可以在 styles 目录下创建新的主题包并修改 iView 默认的 less 变量
// 参考 https://www.iviewui.com/docs/guide/theme
import './stylesIview/index.less'
import './libs/iview-pro/iview-pro.css'

Vue.use(ViewUI, {
  // i18n: (key, value) => i18n.t(key, value)
})
Vue.use(iViewPro)

// ****************************************************************************************************

// 全局注册 CatchTable 组件
// import CatchTable from '@/components/Catch/Table'
// Vue.component('CatchTable', CatchTable)

Vue.config.productionTip = false
Vue.prototype.$http = request

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
